from django.contrib import admin
from .models import Order, OrderItem

# Register your models here.

@admin.register(Order)
class OrderAdmin(admin.ModelAdmin):
    list_display = ['id', 'user', 'restaurant', 'status', 'created_at', 'total_amount']
    list_filter = ['status', 'created_at']
    search_fields = ['id', 'user__username', 'restaurant__name']
    readonly_fields = ['created_at']

@admin.register(OrderItem)
class OrderItemAdmin(admin.ModelAdmin):
    list_display = ['order', 'menu_item', 'quantity', 'price']
    list_filter = ['order__status']
    search_fields = ['order__id', 'menu_item__name']
